<%--
  Created by IntelliJ IDEA.
  User: wzm
  Date: 2023/5/8
  Time: 10:43
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
	<title>Title</title>
</head>
<body>
<center>
<h1>数据页面</h1>
	<a href="employee_add.jsp">(点击新增数据)</a>
<%--取到request中存储的集合--%>
<table width="800px" cellspacing="0" border="1" style="text-align: center">
	<tr>
		<td>员工编号</td>
		<td>员工姓名</td>
		<td>员工密码</td>
		<td>员工年龄</td>
		<td>员工电话</td>
		<td>员工状态</td>
		<td>操作</td>
	</tr>
	<%--取出查询后的数据--%>
	<c:forEach items="${empList}" var="emp">
	<tr>
		<td>${emp.id}</td>
		<td>${emp.userName}</td>
		<td>${emp.passWord}</td>
		<td>${emp.age}</td>
		<td>${emp.phone}</td>
		<td>${emp.status}</td>
		<td>
			<%--点击编辑需要根据id查询原始数据--%>
			<a href="${pageContext.request.contextPath}/selectById?id=${emp.id}">编辑</a>
			<%--点击删除时应该携带id请求servlet然后移除数据--%>
			<a href="${pageContext.request.contextPath}/deleteById?id=${emp.id}">移除</a>
		</td>
	</tr>
	</c:forEach>

</table>
</center>
</body>
</html>
